<template>
  <MyFinishedWorkItem :appCode="appCode" @openForm="openForm"/>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { State } from 'vuex-class';

import flowCenter from '@cloudpivot/flow-center/mobile';

@Component({
  name: 'workitems',
  components: {
    MyFinishedWorkItem: flowCenter.components.MyFinishedWorkItem
  }
})
export default class FinishedWorkitems extends Vue {
  @State('appCode') appCode!: any;

  openForm(workitem:any) {
      //add by sunbo
    if(workitem.jumpUrl !=""){
      var url=workitem.jumpUrl;
      url =url+"&jumpUrlType=yunshu&IsMobile=True&sourceUrl=/tab/home&loginfrom=null&T=yunshu#/form/detail"; 
      window.open(url,'_blank');
        //newWindow.location.href = url+"&IsMobile=True&sourceUrl=/tab/home&loginfrom=null&T=yunshu#/form/detail"; //跳转到第三方代办，Url全路径
    }else{
        this.$router.push({
          name: 'form-detail',
          query: {
            workitemId: workitem.id,
            workflowInstanceId: workitem.instanceId,
            return: this.$route.fullPath,
            workitemType: 'finishedWorkitem'
          }
        }).catch((err: any) => {err});
    }
  }
}

</script>
<style lang="less" scoped>
</style>
